package cn.zwx.member.svc.fallback;

import cn.zwx.base.entity.ResponseEntity;
import cn.zwx.base.exception.BizWrapException;
import cn.zwx.member.svc.dto.MemberConfigSaveDTO;
import cn.zwx.member.svc.facade.MemberConfigApi;
import cn.zwx.member.svc.vo.MemberConfigVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author zhangwenxue
 */
@Component
public class MemberConfigFallback implements FallbackFactory<MemberConfigApi> {

    public static final Logger logger = LoggerFactory.getLogger(MemberConfigFallback.class);
    @Override
    public MemberConfigApi create(Throwable cause) {
        return new MemberConfigApi() {
            @Override
            public MemberConfigFallback create(Throwable cause) {
                logger.error("调用Member-Service fallback",cause);
                return null;
            }

            @Override
            public ResponseEntity<Boolean> saveConfig(MemberConfigSaveDTO saveReqVO) {
                return null;
            }

            @Override
            public ResponseEntity<MemberConfigVO> getConfig() throws BizWrapException {
                return null;
            }
        };
    }
}
